package xerr

type CodeError struct {
	errCode uint32
	errMsg  string
}

func NewMsgError(errMsg string) *CodeError {
	return &CodeError{errCode: ServerCommonErrCode, errMsg: errMsg}
}

func NewCodeError(errCode uint32) *CodeError {
	return &CodeError{errCode: errCode, errMsg: ErrMsgMap(errCode)}
}

func NewCodeMsgError(errCode uint32, errMsg string) *CodeError {
	return &CodeError{errCode: errCode, errMsg: errMsg}
}

func (c *CodeError) GetErrCode() uint32 {
	return c.errCode
}

func (c *CodeError) GetErrMsg() string {
	return c.errMsg
}

func (c *CodeError) Error() string {
	return c.errMsg
}
